<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/oa/contract.js?time=' + sys_get_time();
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			addFilesUploadEvent_contract();
		}
	});
	$('#tname').autocomplete(${(type)!'[]'}, {
	
		max: 12,    //列表里的条目数
		minChars: 0,    //自动完成激活之前填入的最小字符
		width: 220,     //提示的宽度，溢出隐藏
        scrollHeight: 300,   //提示的高度，溢出显示滚动条
        matchContains: true,    //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
        autoFill: false,    //自动填充
        formatItem: function(row, i, max) {
      	  return i + '/' + max + ':"' + row.tname + '"';
        },
        formatMatch: function(row, i, max) {
      	  return row.tname + row.tc;
        },
        formatResult: function(row) {
      	  return row.tname;
		}
	}).result(function(event, row, formatted) {
		$('#tc').val(row.tc);
	});
	$('#editContractForm').find("input:checkbox, input:radio").not('input.ibtn').uniform();
});
</script>
<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3>编辑合同信息</h3>
</div>
<div style="width:400px;float:left;">
	<form id="editContractForm">
		<table class="table boo-table">
			<tr>
				<td>名称</td>
				<td>
					<input type="text" id="name" name="name" value="${(contract.name)!''}" style="width:206px;"/>
					<input type="hidden" id="code" name="code" value="${(contract.code)!''}"/>
					<input type="hidden" id="uuid" name="uuid" value="${(contract.uuid)!''}"/>
					<input type="hidden" id="ext" name="ext" value="${(contract.ext)!''}"/>
					<input type="hidden" id="size" name="size" value="${(contract.size)!''}"/>
				</td>
			</tr>
			<tr>
				<td>合同方</td>
				<td>
					<!-- <input type="radio" name="a" value="false" onclick="showUc_contract();"/>员工&nbsp;&nbsp;
					<input type="radio" name="a" value="true" onclick="showBu_contract();"/>单位 -->
					<input type="text" name="business" value="${(contract.business)!''}"/>
				</td> 
			</tr>
			<tr style="display: none;" id="ucc">
				<td>员工</td>
				<td><@mte.User id='selection2' name='uc' nullstr='请选择' organCode=(cu_organCode) value="${(contract.uc)!''}"/></td>
			</tr>
			<tr style="display: none;" id="bu">
				<td>单位</td>
				<td><input type="text" id="business" name="business" value="${(contract.business)!''}"/></td>
			</tr>
			<tr>
				<td>合同类型</td>
				<td><input id="tname" name="tname" value="${(contract.tname)!''}" type="text"/>
					<input id="tc" name="tc" value="${(contract.tc)!''}" type="hidden"/>
				</td>
			</tr>
			<tr>
				<td style="width: 100px;">合同到期时间</td>
				<td><input type="text" id="end" name="end" value="${(contract.end?string("yyyy-MM-dd"))!''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/></td>
			</tr>
			<tr><td style="width: 40px"><a href="javascript:;" class="btn btn-xs btn-embossed" id="uploadFilesBtn">上传合同</a></td>
				<td id="con">
				<#if (contract.uuid)??>
					<img src="${contextPath}images/flaticon/2.png" onclick="javascript:download_contract(sys_context_path,'${contract.uuid}');"/>
				</#if>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;">
					<a href="javascript:;" class="btn btn-info" onclick="javascript:saveContract_contract(); return false;"><i class="icon-save"></i>保存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('contract'); return false;">取消</a>
				</td>
			</tr>
			
		</table>
	</form>
</div>
